
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
sys.path.append("..")

from snake_game_widget import SnakeGameWidget

class GameDialog(QDialog):

    def __init__(self, parent=None):
        super().__init__(parent)
        # 可以通过此设置，固定对话框的大小
        self.setFixedSize(640, 480)
        
        # 设置对话框标题
        self.setWindowTitle("贪吃蛇大战")
        
        # 设置对话框布局
        self.layout = QVBoxLayout(parent)
        self.layout.setContentsMargins(0, 0, 0, 0)
        
        # 创建一个SnakeGameWidget对象
        self.snake_game_widget = SnakeGameWidget(self)
        self.snake_game_widget.resize(self.size())
        self.layout.addWidget(self.snake_game_widget)
        
        self.initUi()
        

    def initUi(self):
        pass

    def accept(self):
        super().accept()
        print("accept")

    def reject(self):
        super().reject()
        print("reject")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    dialog = GameDialog()
    dialog.show()
    sys.exit(app.exec_())